import 'package:lai_zhan/common/config/ExportConfig.dart';
import 'package:lai_zhan/widget/UserIcon.dart';
import 'package:lai_zhan/widget/CourseItem.dart';
import 'package:lai_zhan/widget/ShopItem.dart';
class CoachPage extends StatefulWidget {

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new _CoachPageState();
  }
}

class _CoachPageState extends State {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new BaseScaffold(title:'私教',
      titleColor: Color(AppColors.white),
      backgroundColor: Color(AppColors.primaryColor),
      back: (){
        NavigatorUtil.goBack(context);
      },
      elevation: 0,
      body: ListView(children: <Widget>[
        new Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            _renderTitleCard(),
            new Padding(padding: EdgeInsets.only(left: 25,right: 25,top: 5,),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    new Text('所在门店',style: AppConstant.middleTextBold,),
                    new ShopItem(),
                    new Container(height: 1,color: Color(AppColors.Grey),),
                    new Container(height: 5,),
                    new Text('开设课程',style: AppConstant.middleTextBold,),
                    new Container(height: 5,),
                    new CourseItem(),
                    new CourseItem(),
                    new CourseItem(),
                  ],)
            )
          ],
        )
      ],),
    );
  }

  Widget _renderTitleCard(){
    return new Stack(
      children: <Widget>[
        _renderBackground(),
        new Positioned(left: 20,bottom: 0,
            child:_renderCard()),
      ],
    );
  }
  _renderBackground(){
    return new Container(
      width: AppSize.ScreenWidth,
      height: AppSize.getRealHeight(150),
      decoration: BoxDecoration(
          gradient: LinearGradient(colors: [Color(AppColors.primaryColor),
          Color(AppColors.lightWhite)],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
          )),);
  }

  _renderCard() {
    return new Card(child: new Container(width: AppSize.ScreenWidth-40,
          height: AppSize.getRealHeight(120),
          child: new Container(
            margin: EdgeInsets.only(left: 20,right: 20,top: 10,bottom: 5),
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                new Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    new Text('张云雷',style: AppConstant.largeTextBold,),
                    new Container(height: 5,),
                    _renderItem(title:'性别',content:'男',centerText:true),
                    _renderItem(title:'电话',content:'17855833972',centerText:true),
                    _renderItem(title:'简历',content:'坚持是最好的努力',centerText:true),
                  ],),
                new UserIcon(size: AppSize.getRealWidth(75),)
              ],
            ),
          )
      ),);
  }

  _renderItem({title,content,centerText=false}){
    return new Row(
      crossAxisAlignment: centerText?CrossAxisAlignment.center:CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.start,
      children: <Widget>[
        new Container(width: AppSize.getRealWidth(50),
          child: new Text(title,style: AppConstant.middleTextBold,),
        ),
        new Container(width: AppSize.getRealWidth(130),
          child: new Text(content,style: AppConstant.middleSubTextBold,),
        ),
      ],
    );
  }
}